import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
    },
  },
  server: {
    port: 5173,
    host: '0.0.0.0', // 允许从任何IP地址访问
    proxy: {
      '/api': 'http://localhost:3005',
    },
    hmr: {
      clientPort: 5173,
      timeout: 120000 // 2分钟
    }
  },
  build: {
    rollupOptions: {
      output: {
        manualChunks: {
          vendor: ['vue', 'vue-router', 'axios', 'element-plus'],
        },
      },
    },
    chunkSizeWarningLimit: 1000, // 增加代码分块大小限制
  }
}); 